<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<!-- 在js中，for循环中的变量没有通过let,var定义，此时就变成了一个全局变量 -->
<script>
    let num = 10
    function test1(){
        // num = 100
        console.log(num)
        function test2(){
            // num = 1000
            console.log(num)
        }
        test2()
    }
    console.log(num)
    test1()
</script>
</html>